﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Windows.Graphics.Display;
using Windows.UI.Xaml;

/**
 * 创建时间：2014/9/26 17:52:17
 * 作者：yong.blackcore
 * Email：itblackhole@outlook.com
 * QQ：50404503
 */
namespace SurfaceAd.Entities
{
    public sealed class OrientationScreenSize
    {
        public double Width { get; set; }
        public double Height { get; set; }


    }

    public sealed class OrientationScreenSizeHelper
    {
        internal static OrientationScreenSize GetScreenSize()
        {
            OrientationScreenSize screenSize = new OrientationScreenSize();
            if (DisplayInformation.GetForCurrentView().CurrentOrientation != DisplayOrientations.Portrait && DisplayInformation.GetForCurrentView().CurrentOrientation != DisplayOrientations.PortraitFlipped)
            {
                if (Window.Current.Bounds.Height <= Window.Current.Bounds.Width)
                {
                    screenSize.Width = Window.Current.Bounds.Width;
                    screenSize.Height = Window.Current.Bounds.Height;
                }
                else
                {
                    screenSize.Width = Window.Current.Bounds.Height;
                    screenSize.Height = Window.Current.Bounds.Width;
                }
            }
            else if (Window.Current.Bounds.Height <= Window.Current.Bounds.Width)
            {
                screenSize.Width = Window.Current.Bounds.Height;
                screenSize.Height = Window.Current.Bounds.Width;
            }
            else
            {
                screenSize.Width = Window.Current.Bounds.Width;
                screenSize.Height = Window.Current.Bounds.Height;
            }
            return screenSize;
        }
    }
}
